import 'package:flutter/cupertino.dart';

class KeepAliveWrapperTabView extends StatefulWidget {
  final Widget child;
  final void Function()? callback;

  const KeepAliveWrapperTabView({super.key, required this.child, this.callback});

  @override
  State<KeepAliveWrapperTabView> createState() => KeepAliveWrapperTabViewState();
}

class KeepAliveWrapperTabViewState extends State<KeepAliveWrapperTabView>
    with AutomaticKeepAliveClientMixin {
  @override
  void initState() {
    widget.callback?.call();
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    super.build(context);
    return widget.child;
  }

  @override
  bool get wantKeepAlive => true;
}